home *** CD-ROM | disk | FTP | other *** search
- /*
- SNEWS 2.0
-
- DEFS.H
-
- General public decls
-
-
- Copyright (C) 1991 John McCombs, Christchurch, NEW ZEALAND
- john@ahuriri.gen.nz
- PO Box 2708, Christchurch, NEW ZEALAND
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License, version 1, as
- published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- See the file COPYING, which contains a copy of the GNU General
- Public License.
- */
-
- /*---------------------------- Source Control ------------------------------*/
-
- /*
- * $Id: DEFS.H,v 1.2 1994/02/05 18:44:34 gbj Exp user $
- */
-
- /****************************************************************************
- * 20 May 92 1.2 GT ka9q mods. *
- * 22 May 92 1.3 GT Fix "reply" and "mail" commands. *
- * 03 Jun 92 1.4 GT Less vigorous message quoting. *
- * 05 Jun 92 1.7 GT SPACE command and From: address parsing. *
- * 06 Jun 92 1.8 GT Fix 1.7. *
- * 07 Jun 92 1.9 GT Fix mail queue directory parameter. *
- * 08 Jun 92 1.10 GT FQDN in "Path:". *
- * 09 Jun 92 1.11 GT Only expand "Path:" in header. *
- * 12 Jun 92 1.12 NJL 50-line mode & lots of other stuff. *
- * 16 Jun 92 1.13 GT Post via "mail2news". *
- * 24 Jun 92 1.14 GT Fix unbatch. *
- * 26 Jun 92 1.15 GT Multiple bug fixes. *
- * 17 Jul 92 1.16 GT C++ compilation. *
- * 16 Aug 92 1.17 MSM Revised to snews 1.90 level *
- * 13 Feb 93 1.18 MSM Local posting added *
- * 20 Feb 93 1.19 MSM Local posting read option *
- * 31 May 93 1.20 MSM Revised to snews 2.00 level *
- * 2 Jul 93 1.21 MSM Editor and Maillog items added to UUCP *
- * 1 Oct 93 1.22 MSM TAB and Header items added to UUCP *
- * 2 Apr 94 1.23 MSM Suspend support added *
- * Footer support added *
- ****************************************************************************/
-
- /*------------------------------- includes --------------------------------*/
-
- #undef DEBUG
-
- #ifdef __TURBOC__
- # include <alloc.h>
- #else
- # ifndef ATARI
- # include <malloc.h>
- # endif
- #endif
- #include <time.h>
- #include <string.h>
- #include <conio.h>
- #include <dos.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #ifdef ATARI
- # include <sys/types.h>
- # include <ext.h>
- #endif
- #include <sys/stat.h>
- #include "version.h"
- #ifdef __TURBOC__
- #include <dir.h>
- #else
- # ifndef ATARI
- # include <direct.h>
- # else
- # include <sys/dir.h>
- # endif
- #endif
-
- /*------------------------------- defines ----------------------------------*/
-
- #define VERSION szVerName
-
- #define HIST_MEM_LIMIT 75000l /* leave this much meme free loading history */
-
- #define ACTIVE_NUM_LEN 8 /* length of the numbers in the active file */
-
- #ifndef TRUE
- #define TRUE 1
- #define FALSE 0
- #endif
-
- #ifdef ATARI
- # define farcoreleft() coreleft
- #endif
-
-
- #ifdef DEBUG
- #define DBGOUT(x) printf x
- #else
- #define DBGOUT(x)
- #endif
-
- #define malloc(x) xmalloc(x)
-
- /*--------------------------------- types -------------------------------------------*/
-
- /*
- * This is the data we get from the UUPC .rc files
- */
-
- typedef struct {
- char temp_name[80]; /* unbatch temp file */
- char news_dir[80]; /* news base directory */
- char incoming_dir[80]; /* incoming news spool directory */
- char user[80]; /* current user id */
- char my_name[80]; /* my full name */
- char my_domain[80]; /* our domain */
- char my_site[80]; /* site name */
- char my_organisation[80]; /* organisation */
- char replyuser[80]; /* Reply-To User Address */
- char mailuser[80]; /* Pseudo mail user for post log */
- char maillog[80]; /* Pseudo mail user for mail */
- char extruser[80]; /* Pseudo mail user for extracts */
- char mail_server[80]; /* where posts are routed to */
- char mail_id[80]; /* ID to mail news articles to */
- char editor[80]; /* system editor */
- char edit_line[80]; /* Editor command line parameter */
- char home[80]; /* home mail directory */
- char signature[80]; /* signature file */
- char spooldir[80]; /* outbound mail directory */
- char quotemark[80]; /* prefix for quoting articles */
- char directvideo; /* direct video flag */
- char mail_dir[80]; /* Location of Mail Directory */
- char nntp_dir[80]; /* Location of ka9q nntp Dir. */
- char localpost; /* Post news locally */
- char localread; /* Don't read local posts */
- char exitconfirm; /* Confirm exit to DOS */
- char expert; /* Expert mode */
- char alias_file[80]; /* Location of the mail aliases */
- char tab_action; /* Old or new tab functionality */
- char header_quote; /* Quote Headers in followups */
- char footer_quote; /* Quote footers in followups */
- char show_unread; /* Group / Thread dispay style */
- int match_len; /* Length of minimum match */
- } INFO;
-
- /*
- * This structure is a linked list of lines that make up an article. The
- * file is read in and the linked list is built.
- *
- * This structure will replace the snews 1.90 LINE structure when
- * conversion is completed.
- *
- */
-
- typedef struct lines {
- char *data; /* line of text */
- struct lines *next; /* next line */
- struct lines *last; /* last line */
- int index; /* line number from start */
- } LINES;
-
- /*
- * NOTE - if hi_num and lo_num are the same there are no articles
- */
-
- typedef struct active {
- char group[60]; /* group name */
- char gp_file[9]; /* name of the file that the data is in */
- long lo_num; /* lowest number less one */
- long hi_num; /* highest number */
- long num_pos; /* file offset of the numbers */
- struct active *next; /* next entry */
- struct active *last; /* last entry */
- int index; /* which number in the list, from 0 */
- char *read_list; /* array hi_num-lo_num long. TRUE=read it */
- int groups; /* filled in by load_active_file() in head */
- int threads; /* filled in by get_headers() */
- int suspend; /* True if suspended */
- } ACTIVE;
-
- /*
- * This singly linked list is used to store the names of the groups
- * we can post to.
- */
-
- typedef struct post_groups {
- char group[60]; /* group name */
- int local; /* local news group 2.0 feature */
- struct post_groups *next; /* next entry */
- } POST_GROUPS;
-
- /*
- * This singly linked list is used to store the name of the groups
- * that are currently suspended.
- */
-
- typedef struct suspend {
- char group[60]; /* group name */
- struct suspend *next; /* next entry */
- } SUSPEND;
-
- /*
- * READ LIST:
- * The list of articles which has been seen by a user is kept in an
- * ascii file, which has a newsgroup name followed by the list
- * of article numbers which have been seen.
- *
- * The file is read by 'load_read_list', which allocates and array of
- * flags, one per article, and plugs these into the ACTIVE structure.
- * The flags are set to TRUE when a user has seen an article.
- *
- * On shutdown a new 'user.nrc' file is written
- */
-
- /*
- * This structure is an index to the history file. 'mid' is a 32bit hash
- * of the message id. 'offset' is the offset into the history file, and
- * 'next' makes the linked list. 'ngroups' is a cross-post count.
- */
-
- typedef struct hist_list {
- long mid; /* hashed Message-ID: */
- int ngroups; /* Number of groups in Newsgroups: */
- long offset; /* ftell() of where in history list this entry is */
- struct hist_list *next;
- } HIST_LIST;
-
- /*
- * This linked list is returned by 'look_up_history'. It is a list
- * of the groups to which an article has been crossposted. It does
- * not include self
- */
-
- typedef struct cross_posts {
- char group[60]; /* group name */
- long art_num; /* article number in this group */
- struct cross_posts *next; /* next entry */
- } CROSS_POSTS;
-
- /*-------------------------------- externs ---------------------------------*/
-
- extern INFO my_stuff;
-
- #ifndef ACTIVE_C
- extern int textb, textf, headb, headf, helpf, helpb, msgf, msgb;
- #endif
-
- /*------------------------------ prototypes --------------------------------*/
-
- ACTIVE *load_active_file(void);
- void close_active_file(void);
- void close_active(void);
- ACTIVE *find_news_group(char *group, int *junk_flag);
- void update_active_entry(ACTIVE *a);
- char *make_news_group_name(char *ng);
- void save_read_list(void);
- void load_read_list(void);
- int load_stuff(void);
- FILE *open_out_file(char *ng, int *junk_flag);
- FILE *open_index_file(char *ng);
- int post_sequence(void);
- void *xmalloc(size_t size);
- int check_valid_post_group(char *ng);
- void free_ng(void);
- FILE *open_hist_file(void);
- void close_hist_file(void);
- void add_hist_record(char *msg_id, char *ng);
- HIST_LIST *load_history_list(int);
- void free_hist_list(void);
- HIST_LIST *find_msg_id(char *msg_id);
- CROSS_POSTS *look_up_history(char *msg_id, char *ng);
- void free_cross_post_list(CROSS_POSTS *cx);
- void abort_error(int, char*);
- SUSPEND *load_suspend(void);
- void free_suspend(SUSPEND*);
- void add_suspend(ACTIVE*);
-